/**
 * Created by vicky on 16/4/27.
 */
// var angular = require('angular');

var app = /* @ngInject */angular.module('app', ['ui.router','ngSanitize','ngCookies','angular-echarts','duScroll','angular-iscroll', 'ui.bootstrap', 'w5c.validator', 'ng-sortable', 'pdf', 'ngFileUpload', 'ngImgCrop']);

//与服务器端的请求交互
var httpService = require('./httpService');
var Common = require('./Common');
var publicService = require('./publicService');
var paginationService = require('./components/pagination/paginationService.js');

//菜单认证
var indexController = require('./login/indexController');
var loginservice = require('./login/loginService');
var loginController = require('./login/loginController');
var registerController = require('./login/registerController');
var registerService = require('./login/registerService');
//补全信息
var registerSuccessController = require('./login/registerSuccessController');
var registerSuccessService = require('./login/registerSuccessService');
//用户认证
var userStation = require('./login/userStation');
var loginsession = require('./login/loginSession');

//邮箱验证后续的东西
var emailrightController = require('./login/emailrightController');
var emailrightService = require('./login/emailrightService');
var emailController = require('./login/emailController');
var emailService = require('./login/emailService');
var registerrightController = require('./login/registerrightController');
var registerrightService = require('./login/registerrightService');
var registerfailController = require('./login/registerfailController');
var registerfailService = require('./login/registerfailService');
//找回密码
var findpasswordController = require('./login/findpasswordController');
var findpasswordService = require('./login/findpasswordService');
var resetpasswordController = require('./login/resetpasswordController');
var resetpasswordService = require('./login/resetpasswordService');
var confirmTeamController = require('./login/confirmTeamController');
var confirmTeamService = require('./login/confirmTeamService');
var successTeamController = require('./login/successTeamController');



/*导航栏*/
var workBarController =  require('./workBar/workBarController');
var workBarService =  require('./workBar/workBarService');
var workBarNoWorkController = require('./workBarNoWork/workBarNoWorkController');
var workBarNoWorkService = require('./workBarNoWork/workBarNoWorkService');
var userInfoController = require('./workBarNoWork/userInfoController');
var userInfoService = require('./workBarNoWork/userInfoService');

var customerBarController = require('./customerBar/customerBarController');
var customerBarService = require('./customerBar/customerBarService');
var caseBarController = require('./caseBar/caseBarController');
var caseBarService = require('./caseBar/caseBarService');
var newCase=require("./commonality/newCase");
var caseBarDetailBarController = require('./caseBar/caseBarDetailBarController');
var caseBarDetailjinchengController = require('./caseBar/caseBarDetailjinchengController');
var caseBarDetailjinchengService = require('./caseBar/caseBarDetailjinchengService');
var caseBarDetailBarService = require('./caseBar/caseBarDetailBarService');
var caseBarDetailxiaController = require('./caseBar/caseBarDetailxiaController');
var caseBarDetailxiaService = require('./caseBar/caseBarDetailxiaService');
var caseBarDetailpeopleController = require('./caseBar/caseBarDetailpeopleController');
var caseBarDetailpeopleService = require('./caseBar/caseBarDetailpeopleService');
var caseBarDetailZhengController = require('./caseBar/caseBarDetailZhengController');
var caseBarDetailZhengService = require('./caseBar/caseBarDetailZhengService');
var caseBarDetailFileController = require('./caseBar/caseBarDetailFileController');
var caseBarDetailFileService = require('./caseBar/caseBarDetailFileService');

var caseBarDetailAnLiController = require('./correlationcase/caseBarDetailAnLiController');
//顶部搜索加载的Controller
var TopcaseBarDetailAnLiController = require('./correlationcase/TopcaseBarDetailAnLiController');
//团队
var teamController = require('./team/teamController');
var teamService = require('./team/teamService');
//接案台
var receiveStandsController = require('./receiveStands/receiveStandsController');
var receiveStandsService = require('./receiveStands/receiveStandsService');
//案源池
var caseSourcesController = require('./receiveStands/caseSourcesController');
var caseSourcesService = require('./receiveStands/caseSourcesService');
var caseSourcesDetailsController = require('./receiveStands/caseSourcesDetailsController');
//接单中心
var orderReceivingController = require('./receiveStands/orderReceivingController');
var orderReceivingService = require('./receiveStands/orderReceivingService');
var orderReceivingDetailsController = require('./receiveStands/orderReceivingDetailsController');
//新加邀请成员
// var confirmTeamController = require('./team/confirm_teamController');
// var successTeamController = require('./team/success_teamController');
var caseBarDetailAnLiService = require('./correlationcase/caseBarDetailAnLiService');
var caseBarDetailAnLiDetailController = require('./correlationcase/caseBarDetailAnLiDetailController');
var caseBarDetailAnLiDetailService = require('./correlationcase/caseBarDetailAnLiDetailService');
var ApplicationController = require('./main/ApplicationController');
var AuthInterceptor = require('./filter/AuthInterceptor');
/**关注的相关案例详情*/
var TwocaseBarDetailAnLiDetailController= require('./correlationcase/TwocaseBarDetailAnLiDetailController');

//日历
var calendarController = require('./caseBar/calendarController');
var calendarService = require('./caseBar/calendarService');


var fileModel = require('./directive/upload_image/fileModel');
var UploaderService = require('./directive/upload_image/fileReader');

var tipShow = require('./directive/tipShow');
var tipshowSales = require('./directive/tipshowSales');
var tipshowProfit = require('./directive/tipshowProfit');
var tipshowEletric = require('./directive/tipshowEletric');
var tipshowLorry = require('./directive/tipshowLorry');
var tipshowTunnel = require('./directive/tipshowTunnel');
var tipshowStock = require('./directive/tipshowStock');
var tipshowLng = require('./directive/tipshowLng');
var reportDate = require('./directive/reportDate');
var taskDetail = require('./directive/taskDetail');
var scrollTop = require('./directive/scrollTop');
var reportDate1 = require('./directive/reportDate1');
var ngEnter = require('./directive/ngenter');
var autofocus = require('./directive/autofocus');
var autofocusmuch = require('./directive/autofocusmuch');

//设置
var settingController = require('./setting/settingController');
var settingService = require('./setting/settingService');

//意见反馈
var feedbackController = require('./feedback/feedbackController');
var feedbackService = require('./feedback/feedbackService');

//邀请好友
var invitationController = require('./quickAdd/invitationController');
var invitationService = require('./quickAdd/invitationService');

//案件动态
var caseBarDetailDongController = require('./messageBar/caseBarDetailDongController');
var caseBarDetailDongService = require('./messageBar/caseBarDetailDongService');
//财务中心
var financeCenterService = require('./financeCenter/financeCenterService');
var financeCenterController = require('./financeCenter/financeCenterController');

//消息页面
var newsController = require('./news/newsController');
var newsService = require('./news/newsService');
//注册时详情页面的Controller
var synopsisController=require('./commonality/synopsisController');

//记账
var caseBarAccountController = require('./caseBar/caseBarAccountController');
//记账 筛选
var caseBarAccountService = require('./caseBar/caseBarAccountService.js');
//案件统计
var caseBarStatisticsController = require('./caseBar/caseBarStatisticsController');
var caseBarStatisticsService = require('./caseBar/caseBarStatisticsService');
//文书
var caseBarWritController = require('./caseBar/caseBarWritController');
var caseBarWritService = require('./caseBar/caseBarWritService');
//合同库
var contractLibraryController=require('./contractLibrary/contractLibraryController');
var contractLibraryService=require('./contractLibrary/contractLibraryService');
//合同库列表页
var contractLibraryListController=require('./contractLibrary/contractLibraryListController');
//合同预览
var contractLibraryViewController=require('./contractLibrary/contractLibraryViewController');
//合同库 我的收藏
var contractLibraryCollectController=require('./contractLibrary/contractLibraryCollectController');

//客户端统计
// var StatisticsController = require('./caseBar/StatisticsController');


//  交互路径
app
  .constant('httpservice', httpService)
  .constant('Common', Common)
  .service('workBarService', workBarService)
  .service('workBarNoWorkService', workBarNoWorkService)
  .service('userInfoService', userInfoService)
  .service('newsService', newsService)
  .service('customerBarService', customerBarService)
  .service('registerService', registerService)
  .service('caseBarService', caseBarService)
  .service('emailrightService', emailrightService)
  .service('emailService', emailService)
  .service('registerrightService', registerrightService)
  .service('registerfailService', registerfailService)
  .service('findpasswordService', findpasswordService)
  .service('resetpasswordService', resetpasswordService)
  .service('caseBarDetailpeopleService', caseBarDetailpeopleService)
  .service('caseBarDetailBarService', caseBarDetailBarService)
  .service('caseBarDetailDongService', caseBarDetailDongService)
  .service('caseBarDetailjinchengService', caseBarDetailjinchengService)
  .service('caseBarDetailxiaService', caseBarDetailxiaService)
  .service('caseBarDetailZhengService', caseBarDetailZhengService)
  .service('caseBarDetailFileService', caseBarDetailFileService)
  .service('caseBarDetailAnLiService', caseBarDetailAnLiService)
  .service('caseBarDetailAnLiDetailService', caseBarDetailAnLiDetailService)
  .service('templateService', receiveStandsService)
  .service('settingService', settingService)
  .service('feedbackService', feedbackService)
  .service('invitationService', invitationService)
  .service('calendarService', calendarService)
  .service('newCase', newCase)
  .service('caseBarAccountService', caseBarAccountService)
  .service('teamService', teamService)
  .service('registerSuccessService', registerSuccessService)
  .service('caseBarWritService', caseBarWritService)
  .service('confirmTeamService', confirmTeamService)
  .service('caseSourcesService', caseSourcesService)
  .service('orderReceivingService', orderReceivingService)
  .service('contractLibraryService', contractLibraryService)
  .service('financeCenterService', financeCenterService)
  .service('caseBarStatisticsService',caseBarStatisticsService);
//日历


/*app //公共查询Service
 .factory('Public_Service',public_Select_Service);*/

app
  .controller('ApplicationController',ApplicationController)
  .factory('AuthInterceptor',AuthInterceptor);

app
  .directive('tipShow',tipShow)
  .directive('tipshowSales',tipshowSales)
  .directive('tipshowProfit',tipshowProfit)
  .directive('tipshowEletric',tipshowEletric)
  .directive('tipshowLorry',tipshowLorry)
  .directive('tipshowTunnel',tipshowTunnel)
  .directive('tipshowStock',tipshowStock)
  .directive('tipshowLng',tipshowLng)
  .directive('reportDate',reportDate)
  .directive('reportDate1',reportDate1)
  .directive('fileModel',fileModel)
  .directive('fyTaskDetail',taskDetail)
  .directive('ngEnter',ngEnter)
  .directive('autofocus', autofocus)
  .directive('scrollTop', scrollTop)
  .directive('autoFocusMuch', autofocusmuch)
  .factory('fileReader',UploaderService);


app //  使用一个对象工厂函数定义服务
  .factory('loginService',loginservice)
  //.factory('authService',authservice)
  //.factory('loginOutService',loginOutService)
  //  使用一个类构造函数定义服务
  .service('Session',loginsession)
  //  使用一个常量定义服务  用户状态
  .constant('AUTH_EVENTS', userStation.AUTH_EVENTS)
  //  使用一个常量定义服务  用户角色权限
  .constant('USER_ROLES', userStation.USER_ROLES)
  //通用方法
  .factory('publicService',publicService)
  .factory('paginationService',paginationService);

app
  .config(function ($httpProvider) {
    $httpProvider.interceptors.push([
      '$injector',
      function ($injector) {
        return $injector.get('AuthInterceptor');
      }
    ]);
  });

app.config(function (iScrollServiceProvider) {
  // Supply a default configuration object, eg:
  iScrollServiceProvider.configureDefaults({
    iScroll: {
      // Passed through to the iScroll library
      scrollbars: true,
      interactiveScrollbars: true,
      vScroll:false
    },
    directive: {
      // Interpreted by the directive
      refreshInterval: 5000
    }
  });
});
app.config(["w5cValidatorProvider", function (w5cValidatorProvider) {
  // 全局配置
  w5cValidatorProvider.config({
    blurTrig   : true,
    showError  : true,
    removeError: true
  });
  w5cValidatorProvider.setRules({
    email: {
      required: "输入的邮箱地址不能为空",
      email   : "输入邮箱地址格式不正确"
    },
    phonenum: {
      required: "* 手机号不能为空",
      w5cuniquecheck: "当前手机号已被使用"
    },
    lawfirm: {
      required: "* 律所不能为空",
      customizer: "请选择律所"
    },
    practiceNum: {
      required: "* 执业证号不能为空",
      w5cuniquecheck: "当前手机号已被使用"
    },
    name: {
      required: "* 姓名不能为空"
    },
    msgcode: {
      required: "* 验证码不能为空"
    }
  });
}]);
app.filter("highlight", function($sce, $log){
  var fn = function(text, search){
    /*$log.info("text: " + text);
    $log.info("search: " + search);*/

    if (!search) {
      return $sce.trustAsHtml(text);
    }
    text = encodeURI(text);
    search = encodeURI(search);

    var regex = new RegExp(search, 'gi');
    var result = text.replace(regex, '<span style="color:#01BEB8;display: inline;">$&</span>');
    result = decodeURI(result);
    // $log.info("result: " + result );
    return $sce.trustAsHtml(result);
  };
  return fn;
})
  .filter('caseSourcesFilter',function(){
  var ffn= function(input,business){
    if(business){
      for(var i=0;i<business.length;i++){
        if(input==business[i].code){
          input=business[i].name;
        }
      }
    }
    return input;
  }
  return ffn;
});

app.config(function ($httpProvider) {
  $httpProvider.defaults.withCredentials = true;//请求时携带cookie
});
app
  .run(function($rootScope,$state,$cookies){
    //错误消息定义
    $rootScope.errorMessage = {
      show: false,
      content: null
    };

    //监听路由
    $rootScope.$on('$stateChangeStart',function(event,toState){
      if (toState.name != "loginHeader.login" && toState.name != "loginHeader.register" && toState.name != "weixin"
        && toState.name != "loginHeader.emailright" && toState.name != "loginHeader.registerright" && toState.name != "email"
        && toState.name != "loginHeader.registerfail" && toState.name != "loginHeader.findpassword" && toState.name != "loginHeader.resetpassword"
        && toState.name != "confirmTeam" && toState.name != "successTeam"
        &&toState.name != "index" &&toState.name != "termService" &&toState.name != "privacyStatemant" &&toState.name != "contact"
        &&toState.name != "regardsWe") {

          var phone = $cookies.get('userIdBenDiFilter');
          if (phone == null || phone =='' || phone == undefined) {
            event.preventDefault();
            $state.go('loginHeader.login');
          }
        }
    });

    //链接socket
    $rootScope.startWebSocket = function (userId){
      $rootScope.ws;
      if ('WebSocket' in window) {
        $rootScope.ws = new ReconnectingWebSocket(""+httpService.webSocketUrl+"websocket/"+userId+"");
      } else if ('MozWebSocket' in window) {
        $rootScope.ws = new ReconnectingWebSocket(""+httpService.webSocketUrl+"websocket/"+userId+"");
      } else {
        $rootScope.ws = new SockJS(""+httpService.murlWebHttp+"websocket/"+userId+"");
      }
      $rootScope.ws.debug = true;
      $rootScope.ws.timeoutInterval = 5400;
      $rootScope.ws.onopen = function(){
        //$("#sendbutton").attr("disabled", false);
      };
      $rootScope.ws.onmessage = function(event)
      {
        $rootScope.showNotice(event.data);
      };
      $rootScope.ws.onclose = function(event) {
        console.log('关闭websocket',event);
        websocket.close();
      };
      //监听窗口关闭事件，当窗口关闭时，主动去关闭websocket连接，防止连接还没断开就关闭窗口，server端会抛异常。
      window.onbeforeunload = function () {
        websocket.close();
      }
    };


    //展示提示信息
    $rootScope.showNotice = function (msg){
      var Notification = window.Notification || window.mozNotification || window.webkitNotification;
      if(Notification){
        Notification.requestPermission(function(status){
          //status默认值'default'等同于拒绝 'denied' 意味着用户不想要通知 'granted' 意味着用户同意启用通知
          if("granted" != status){
            return;
          }else{
            var tag = "sds"+Math.random();
            var notify = new Notification(
              "您有一条新的消息",
              {
                dir:'auto',
                lang:'zh-CN',
                tag:tag,//实例化的notification的id
                icon:'img/logo-page.png',//通知的缩略图,//icon 支持ico、png、jpg、jpeg格式
                body:msg //通知的具体内容
              }
            );
            notify.onclick=function(){
              //如果通知消息被点击,通知窗口将被激活
              window.focus();
            },
              notify.onerror = function () {
                console.log("HTML5桌面消息出错！！！");
              };
            notify.onshow = function () {
              setTimeout(function(){
                notify.close();
              },10000)
            };
            notify.onclose = function () {
              console.log("HTML5桌面消息关闭！！！");
            };
          }
        });
      }else{
        console.log("您的浏览器不支持桌面消息");
      }
    };
    var phone = $cookies.get('userIdBenDiFilter');
    if (phone != null && phone !='' || phone != undefined) {
      var userId = kbt.decrypt($cookies.get('cookieUserId'));
      if (userId != null && userId != "" && userId != undefined) {
        $rootScope.startWebSocket(userId);
      }
    }

  })
  .config(function ($stateProvider, $urlRouterProvider, $locationProvider ) {

    // 当找不到路由状态时自动跳转first状态
    $urlRouterProvider.otherwise("/index");
    $urlRouterProvider.when("",'/index');
    $urlRouterProvider.when('/login', 'header/login');
    $urlRouterProvider.when('/workBar', 'workBar/workBarNoWork');
    $urlRouterProvider.when('/workBar/receiveStands', 'workBar/receiveStands/caseSources');
    $urlRouterProvider.when('/workBar/contractLibrary','workBar/contractLibrary/contractLibraryList');
    //设置路由地址
    $stateProvider
    //主页面
      .state('main', {
        url: "/main",
        templateUrl: "main.html",
        controller: function ($scope) {
        }
      })
      //首页-index
      .state('index', {
        url: "/index",
        templateUrl: "partials/index/index.html",
        controller: indexController
      })
      // 登录头部
      .state('loginHeader', {
        url: "/header",
        templateUrl: "partials/login/loginHeader.html"
      })
      //菜单登陆页
      .state('loginHeader.login', {
        url: "/login",
        templateUrl: "partials/login/login.html",
        controllerAs: "loginCon",
        controller: loginController
      })
      .state('weixin', {
        url: "/weixin",
        templateUrl: "partials/login/weixin.html"
      })
      //注册页面
      .state('loginHeader.register', {
        url: "/register",
        templateUrl: "partials/login/register.html",
        controller: registerController
      })
      // 注册成功
      .state('workBar.registerSuccess', {
        url: "/registerSuccess",
        templateUrl: "partials/login/registerSuccess.html",
        controller: registerSuccessController,
        controllerAs: "vm"
      })
      //服务条款
      .state('termService', {
        url: "/termService",
        templateUrl: "partials/login/termsheet/termService.html",
        controller: synopsisController
      })
      //隐私政策
      .state('privacyStatemant', {
        url: "/privacyStatemant",
        templateUrl: "partials/login/termsheet/privacyStatemant.html",
        controller: synopsisController
      })
      //联系我们
      .state('contact', {
        url: "/contact",
        templateUrl: "partials/login/termsheet/contact.html",
        controller: synopsisController
      })
      //关于我们
      .state('regardsWe', {
        url: "/regardsWe",
        templateUrl: "partials/login/termsheet/regardsWe.html",
        controller: synopsisController
      })
      //邮箱验证一系列
      .state('loginHeader.emailright', {
        url: "/emailright/{email}",
        templateUrl: "partials/login/emailright.html",
        controller: emailrightController
      })
      .state('loginHeader.email', {
        url: "/email/{email}",
        templateUrl: "partials/login/email.html",
        controller: emailController
      })
      .state('loginHeader.registerright', {
        url: "/registerright",
        templateUrl: "partials/login/registerright.html",
        controller: registerrightController
      })
      .state('loginHeader.registerfail', {
        url: "/registerfail/{email}",
        templateUrl: "partials/login/registerfail.html",
        controller: registerfailController
      })
      //找回密码系列
      .state('loginHeader.findpassword', {
        url: "/findpassword",
        templateUrl: "partials/login/findpassword.html",
        controller: findpasswordController
      })
      .state('loginHeader.resetpassword', {
        // url: "/resetpassword/{token}/{type}/{phoneNum}",
        url: "/resetpassword",
        // url: "/resetpassword/{phoneNum}",
        templateUrl: "partials/login/resetpassword.html",
        controller: resetpasswordController
      })

      .state('workBar', {
        url: "/workBar",
        templateUrl: "partials/workBar/workBar.html",
        abstract:true,
        controller: workBarController
      })
      /*工作台*/
      .state('workBarNoWork', {
        url: "/workBarNoWork",
        templateUrl: "partials/workBar/workBarNoWork.html",
        parent:"workBar",
        controller: workBarNoWorkController
      })
      .state('userInfo', {/*用户信息*/
        url: "/userInfo",
        templateUrl: "partials/workBar/user-info.html",
        parent:"workBar",
        controller: userInfoController
      })
      /*消息*/
      .state('news', {
        url: "/news",
        templateUrl: "partials/workBar/news.html",
        parent:"workBar",
        controller: newsController
      })
      /*客户版*/
      .state('cusBar', {
        url: "/cusBar",
        templateUrl: "partials/workBar/cust-manag.html",
        parent:"workBar",
        controller: customerBarController
      })
      /*客户版统计*/
      .state('customerStatistics', {
        url: "/cusBar/Z-Statistics",
        templateUrl: "partials/workBar/Z-Statistics.html",
        parent:"workBar",
        // controller: StatisticsController
      })
      /*团队*/
      .state('team', {
        url: "/team",
        templateUrl: "partials/team/team_member.html",
        parent:"workBar",
        controller: teamController
      })

      /*确认加入团队*/
      .state('confirmTeam', {
        // url: "/confirmTeam/{token}/{type}/{phoneNum}",
        url: "/confirmTeam",
        templateUrl: "partials/team/confirm_team.html",
        controller: confirmTeamController
      })

      /*加入团队成功*/
      .state('successTeam', {
        url: "/successTeam/{teamName}",
        templateUrl: "partials/team/success_team.html",
        // parent:"workBar",
        controller: successTeamController
      })
      /*案件板*/
      .state('caseBar', {
        url: "/caseBar/{from}",
        templateUrl: "partials/workBar/caseBarHome.html",
        parent:"workBar",
        controller: caseBarController,
        // controller: "caseBarNavController",
        // controllerAs:"caseBar"
      })
      //案件版导航条
      .state('caseBarDetailBar', {
        url: "/caseBarDetailBar",
        templateUrl: "partials/workBar/caseBarDetailBar.html",
        parent:"workBar",
        controller: caseBarDetailBarController,
      })
      //.state('caseBarDetailjincheng2', {
      //    url: "/caseBarDetailjincheng2",
      //    templateUrl: "partials/workBar/caseBarDetailBarJin.html",
      //    parent:"workBar",
      //    controller: caseBarDetailjinchengController
      //})
      .state('caseBarDetailjincheng', {
        url: "/caseBarDetailjincheng",
        templateUrl: "partials/workBar/caseBarDetailBarJin.html",
        parent:"caseBarDetailBar",
        controller: caseBarDetailjinchengController
      })
      .state('caseBarDetailxia', {
        url: "/caseBarDetailxia/{type}",
        templateUrl: "partials/workBar/caseBarDetailxia.html",
        parent:"caseBarDetailBar",
        controller: caseBarDetailxiaController,
      })
      .state('caseBarDetailpeople', {
        url: "/caseBarDetailpeople",
        templateUrl: "partials/workBar/caseBarDetailpeople.html",
        parent:"caseBarDetailBar",
        controller: caseBarDetailpeopleController
      })
      .state('caseBarDetailZheng', {
        url: "/caseBarDetailZheng",
        templateUrl: "partials/workBar/caseBarDetailZheng.html",
        parent:"caseBarDetailBar",
        controller: caseBarDetailZhengController,
      })
      .state('caseBarDetailFileManager', {
        url: "/caseBarDetailFileManager",
        templateUrl: "partials/workBar/caseBarDetailFileManager.html",
        parent:"caseBarDetailBar",
        controller: caseBarDetailFileController
      })
      //案件动态
      .state('caseBarDetailDong', {
        url: "/caseBarDetailDong",
        templateUrl: "partials/workBar/caseBarDetailDong.html",
        parent:"caseBarDetailBar",
        controller: caseBarDetailDongController
      })
      //记账
      .state('caseBarAccount', {
        url: "/caseBarAccount",
        templateUrl: "partials/workBar/caseBar_Account.html",
        parent:"caseBarDetailBar",
        controller: caseBarAccountController,
        controllerAs:"caseBarAccount",
      })
      //统计
      .state('caseBarStatistics', {
        url: "/caseBarStatistics",
        templateUrl: "partials/workBar/caseBar_Statistics.html",
        parent:"caseBarDetailBar",
        controller: caseBarStatisticsController,
        // controllerAs:"caseBarStatistics",
      })
      //文书
      .state('caseBarWrit', {
        url: "/caseBarWrit",
        templateUrl: "partials/workBar/caseBarWrit.html",
        parent:"caseBarDetailBar",
        controller: caseBarWritController,
        controllerAs:"caseBarWrit",
      })
      /*相关案例*/
      .state('caseBarDetailAnLi2', {
        url: "/caseBarDetailAnLi2/{messages}",
        templateUrl: "partials/workBar/TopcaseBarDetailAnLi.html",
        parent:"workBar",
        controller: TopcaseBarDetailAnLiController
      })
      .state('caseBarDetailAnLi', {
        url: "/caseBarDetailAnLi/{message}",
        templateUrl: "partials/workBar/caseBarDetailAnLi.html",
        parent:"caseBarDetailBar",
        controller: caseBarDetailAnLiController
      })
      .state('caseBarDetailAnLiDetail', {
        url: "/caseBarDetailAnLiDetail",
        templateUrl: "partials/workBar/caseBarDetailAnLiDetail.html",
        parent:"caseBarDetailBar",
        controller: caseBarDetailAnLiDetailController
      })
      .state('caseBarDetailAnLiDetail2', {
        url: "/caseBarDetailAnLiDetail2",
        templateUrl: "partials/workBar/caseBarDetailAnLiDetail.html",
        parent:"workBar",
        controller: caseBarDetailAnLiDetailController
      })
      //接案台
      .state('receiveStands', {
        url: "/receiveStands",
        templateUrl: "partials/receiveStands/receiveStands.html",
        parent:"workBar",
        controller: receiveStandsController
      })
      //案源池
      .state('caseSources', {
        url: "/caseSources",
        templateUrl: "partials/receiveStands/caseSources.html",
        parent:"receiveStands",
        controller: caseSourcesController
      })//案源池 详情页
      .state('caseSourcesDetails', {
        url: "/caseSourcesDetails/{billId}/{serviceid}",
        templateUrl: "partials/receiveStands/caseSourcesDetails.html",
        parent:"caseSources",
        controller: caseSourcesDetailsController
      })
      //接单中心
      .state('orderReceiving', {
        url: "/orderReceiving",
        templateUrl: "partials/receiveStands/orderReceiving.html",
        parent:"receiveStands",
        controller: orderReceivingController
      })//接单中心 详情页
      .state('orderReceivingDetails', {
        url: "/orderReceivingDetails/{id}",
        templateUrl: "partials/receiveStands/orderReceivingDetails.html",
        parent:"orderReceiving",
        controller: orderReceivingDetailsController
      })
      /**关注的相关案例*/
      .state('caseBarDetailAnLiDetail3', {
        url: "/caseBarDetailAnLiDetail3",
        templateUrl: "partials/workBar/caseBarDetailAnLiDetailtwo.html",
        parent:"caseBarDetailBar",
        controller: TwocaseBarDetailAnLiDetailController
      })
      /*设置*/
      .state('setting', {
        url: "/setting",
        templateUrl: "partials/setting/user-setting-msg.html",
        parent:"workBar",
        controller: settingController,
        controllerAs:"userController",
      })
      .state('safe', {
        url: "/safe",
        templateUrl: "partials/setting/y-user-setting-msg.html",
        parent:"workBar",
        controller: settingController
      })
      //财务中心
      .state('financeCenter', {
        url: "/financeCenter",
        templateUrl: "partials/financeCenter/financeCenterList.html",
        parent:"workBar",
        controller: financeCenterController
      })
      .state('financeCenterDetails', {
        url: "/financeCenterDetails",
        templateUrl: "partials/financeCenter/financeCenterDetails.html",
        parent:"financeCenter",
        controller: financeCenterController
      })
     //合同库
      .state('contractLibrary', {
        url: "/contractLibrary",
        templateUrl: "partials/contractLibrary/contractLibrary.html",
        parent:"workBar",
        controller: contractLibraryController
      })
     //合同库列表页
      .state('contractLibraryList', {
        url: "/contractLibraryList",
        templateUrl: "partials/contractLibrary/contractLibraryList.html",
        parent:"contractLibrary",
        controller: contractLibraryListController
      })

      //合同预览页
      .state('contractLibraryView', {
        url: "/contractLibraryView/{id}",
        templateUrl: "partials/contractLibrary/contractLibraryView.html",
        parent:"contractLibrary",
        controller: contractLibraryViewController
      })
        //合同库 我的收藏
      .state('contractLibraryCollect', {
        url: "/contractLibraryCollect",
        templateUrl: "partials/contractLibrary/contractLibraryCollect.html",
        parent:"contractLibrary",
        controller: contractLibraryCollectController
      })
      /*意见反馈*/
      // .state('feedback', {
      //   url: "/feedback",
      //   templateUrl: "partials/setting/feedback.html",
      //   parent:"workBar",
      //   controller: feedbackController
      // })
      /*邀请好友*/
      .state('invitation', {
        url: "/invitation",
        templateUrl: "partials/quickAdd/invitation.html",
        parent:"workBar",
        controller: invitationController
      })
      /*案件版日历*/
      .state('calendar', {
        url: "/calendar",
        templateUrl: "partials/workBar/calendar.html",
        parent:"caseBarDetailBar",
        controller: calendarController
      })
      // 全局日程
      .state('schedule', {
        url: "/schedule",
        templateUrl: "partials/workBar/schedule.html",
        parent:"workBar",
        controller: calendarController
      });
    $locationProvider.html5Mode(true);

  });
